package com.dragon.repository.domain.vo;

import com.dragon.common.model.Update;
import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.AdminDepartment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author sy
 */
@Data
@ApiModel(value = "")
public class AdminDepartmentVO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    private Integer id;

    @ApiModelProperty(value = "部门id")
    private Integer departmentId;

    @ApiModelProperty(value = "用户id")
    private Integer adminId;

    private Date updateTime;


    @NotNull(groups = Update.class,message = "主键不能为空")
    public static AdminDepartment convert(AdminDepartmentVO vo) {
        AdminDepartment entity = new AdminDepartment();
        BeanUtils.copyProperties(vo,entity);
        return entity;
    }
    public static List<AdminDepartment> convertList(List<AdminDepartmentVO> list) {
        List<AdminDepartment> resultList = new ArrayList<>();
        for (AdminDepartmentVO vo : list) {
            resultList.add(convert(vo));
        }
        return resultList;
    }
}
